<?php
/**
     * 矩阵从左到右从上到下递增
     * @return mixed
     */
    public function juZhen()
    {
        $array = [
            [1, 4, 7, 11, 15],
            [2, 5, 8, 12, 19],
            [3, 6, 9, 16, 22],
            [10, 13, 14, 17, 24],
            [18, 21, 23, 26, 30]
        ];

        $search = 100;
        $row = count($array) - 1;
        $col = count($array[0]) - 1;
        $i = 0;
        $j = $col;
        while ($i <= $row && $j >= 0) {
            if ($search == $array[$i][$j]) {
                return true;
            } elseif ($search > $array[$i][$j]) {
                $i++;
            } elseif ($search < $array[$i][$j]) {
                $j--;
            }
        }
        return false;
    }
    var_dump($this->juZhen());